package cn.pacerx.running.db.dao;

import cn.pacerx.running.db.domain.Activity;
import io.mybatis.mapper.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;

public interface ActivityMapper extends Mapper<Activity, Long> {
    @Update("UPDATE activity set status=#{status} WHERE id = #{id} and update_time = #{lastUpdateTime}")
    int updateWithOptimisticLocker(@Param("lastUpdateTime") LocalDateTime lastUpdateTime, @Param("id") Long id,
                                   @Param("status") Integer status);
}
